package com.gton.controller;

import com.gton.client.ProducerClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: springcloud-nacos
 * @description: 消费者Controller
 * @author: GuoTong
 * @create: 2020-11-20 11:15
 **/
@RestController
public class ConsumerController {

    private static final Logger logger = LoggerFactory.getLogger(ConsumerController.class);

    /**
     * 动态代理对象，内部远程调用服务生产者
     */
    @Autowired
    private ProducerClient producerClient;


    @GetMapping("/service")
    public String service(){
        logger.info("consumer invoke");
        //远程调用
        String service = producerClient.service();
        return "comsumer invoke "+"|" + service;
    }
}
